package org.jeecg.modules.staff.fault.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.staff.fault.service.StaffFaultService;
import org.jeecg.modules.user.abnormal.dto.FaultReq;
import org.jeecg.modules.utils.BikeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Api(tags="运维端上报故障")
@RestController
@RequestMapping("/app/staff")
@Slf4j
public class FaultStaffController {

    @Autowired
    private StaffFaultService staffFaultService;

    @ApiOperation(value = "上报故障记录", notes = "上报故障记录")
    @RequestMapping(value = "/insertStaffFault", method = RequestMethod.POST)
    public BikeResult insertFault(@RequestBody FaultReq faultReq, HttpServletRequest request){
        return staffFaultService.insertStaffFault(faultReq,request);
    }

    @ApiOperation(value = "查询故障记录", notes = "查询故障记录")
    @RequestMapping(value = "/getStaffFaultList", method = RequestMethod.GET)
    public BikeResult getFaultList(@RequestParam("pageNum")Integer pageNum, @RequestParam("pageSize")Integer pageSize, HttpServletRequest request){
        return staffFaultService.getStaffFaultList(pageNum,pageSize,request);
    }
}
